package com.sunnay.controller;

import com.sunnay.entity.AppUserHelperEntity;
import com.sunnay.service.AppUserHelperService;
import com.sunnay.util.R;
import com.sunnay.vo.helper.HelperRequestVo;
import com.sunnay.web.ContextHelper;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/helper")
public class HelperController {

    @Resource
    private AppUserHelperService appUserHelperService;

    @GetMapping("/list")
    public R<List<AppUserHelperEntity>> list(){
        return R.ok(appUserHelperService.list(ContextHelper.getSystemUser()));
    }

    @PutMapping
    public R<Boolean> updateInfo(@RequestBody HelperRequestVo requestVo){
        appUserHelperService.updateInfo(requestVo,ContextHelper.getSystemUser());
        return R.ok();
    }
}
